//package com.ocl.www.document;
//
//import java.io.IOException;
//
//import org.apache.solr.client.solrj.SolrQuery;
//import org.apache.solr.client.solrj.SolrServer;
//import org.apache.solr.client.solrj.SolrServerException;
//import org.apache.solr.client.solrj.response.QueryResponse;
//import org.apache.solr.client.solrj.response.UpdateResponse;
//import org.apache.solr.common.SolrDocumentList;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.solr.core.SolrOperations;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import com.ocl.www.domain.User;
//
////此类与系统无关，只为测试jvm运行原理（loginController）
//
//public class Test {
//
//	//@Autowired
//	//private SolrServer server;
//
//	public void aa(){
//		
//		//System.out.println("1111111");
//		System.out.println("6666666");
//		//System.out.println(server.toString());
//		
//	}
//}
//	
////	
//////	private static SolrServer server;
////    
////
//////    private static final String DEFAULT_URL = "http://localhost:8983/solr/collection1";
//////    
//////    public static void init() {
//////        server = new HttpSolrServer(DEFAULT_URL);
//////    }
////    
////    public void indexUser(User user){
////        try {
////            //添加user bean到索引库
////            try {
////                UpdateResponse response = server.addBean(user);
////                server.commit();
////                System.out.println(response.getStatus());
////            } catch (IOException e) {
////                e.printStackTrace();
////            }
////        } catch (SolrServerException e) {
////            e.printStackTrace();
////        } 
////    }
////    
////    //测试添加一个新的bean实例到索引
////    public void testIndexUser(){
////        User user = new User();
////        user.setUserName("1");
////        user.setNickName("cdebcdccga");
////        
////        indexUser(user);
////    }
////    
////    public void testQueryAll() {
////        SolrQuery params = new SolrQuery();
////        
////        // 查询关键词，*:*代表所有属性、所有值，即所有index
////        params.setQuery("userName:2");
////        params.setQuery("nickName:cd");
////        
////        // 分页，start=0就是从0开始，rows=5当前返回5条记录，第二页就是变化start这个值为5就可以了。
////        params.set("start", 0);
////        params.set("rows", Integer.MAX_VALUE);
////            
////        // 排序，如果按照id排序，那么将score desc 改成 id desc(or asc)
////        // params.set("sort", "score desc");
//////        params.set("sort", "id asc");
////        
////        // 返回信息*为全部，这里是全部加上score，如果不加下面就不能使用score
////        params.set("fl", "*,score");
////        
////        
////        QueryResponse response = null;
////        try {
//////            response = server.query(params);
////        } catch (SolrServerException e) {
////            e.printStackTrace();
////        }
////        
////        if(response!=null){
////            System.out.println("Search Results: ");
////            SolrDocumentList list = response.getResults();
////            for (int i = 0; i < list.size(); i++) {
////                System.out.println(list.get(i));
////            }
////        }
////    }
////     
////    public static void main(String[] args) {
////        //init();
////        Test t = new Test();
//////        t.testIndexUser();
////        //testQueryAll();
////    	t.aa();
////    }
////}
